<nz-modal [(nzVisible)]="isVisible" [nzWidth]="modalWidth" (nzOnCancel)="onBack()" [nzStyle]="{'top': '50px'}">
  <div *nzModalTitle>{{ title }}</div>
  <ng-container *nzModalContent>
    <form nz-form class="search-form" [formGroup]="searchForm" (keydown.enter)="$event.preventDefault();onSearch()" nzLayout="inline">
      <nz-form-item>
        <nz-form-label nzFor="name">公共设施名称</nz-form-label>
        <nz-form-control>
          <input nz-input formControlName="name" placeholder="请输入公共设施名称" />
        </nz-form-control>
      </nz-form-item>
      <nz-form-item>
        <nz-form-label nzFor="buildingName">楼栋名称</nz-form-label>
        <nz-form-control>
          <nz-input-group nzSearch [nzAddOnAfter]="buildingNameSuffixIconButton">
            <input nz-input formControlName="buildingName" placeholder="请选择楼栋名称" readonly />
          </nz-input-group>
          <ng-template #buildingNameSuffixIconButton>
            <button nz-button nzType="primary" nzSearch (click)="findBuilding()"><nz-icon nzType="search" /></button>
          </ng-template>
        </nz-form-control>
      </nz-form-item>
<nz-form-item>
        <nz-form-label nzFor="location">位置</nz-form-label>
        <nz-form-control>
          <input nz-input formControlName="location" placeholder="请输入位置" />
        </nz-form-control>
      </nz-form-item>
      <nz-form-item>
        <nz-form-label nzFor="status">状态</nz-form-label>
        <nz-form-control>
          <nz-select formControlName="status" class="custom-select-width">
            <nz-option nzLabel="正常" [nzValue]="10"></nz-option>
            <nz-option nzLabel="异常" [nzValue]="20"></nz-option>
          </nz-select>
        </nz-form-control>
      </nz-form-item>
      <button nz-button type="button" nzType="primary" [nzLoading]="searchLoading" (click)="onSearch()">查询</button>
      <button nz-button type="button" class="margin-button" (click)="onReset()">重置</button>
    </form>
    <nz-table #basicTable [nzData]="listOfData" [nzTotal]="total" [nzLoading]="searchLoading" nzSize="small">
      <thead>
        <tr>
          <th>公共设施名称</th>
          <th>楼栋名称</th>
          <th>位置</th>
          <th>最后保养日期</th>
          <th>状态</th>
        </tr>
      </thead>
      <tbody>
        <tr *ngFor="let data of basicTable.data" (dblclick)="onRowDblClick(data, $event)">
          <td>{{data.name}}</td>
          <td>{{data.buildingName}}</td>
          <td>{{data.location}}</td>
          <td>{{data.lastMaintenanceDate}}</td>
          <td>
            <ng-container *ngIf="data.status === 10">正常</ng-container>
            <ng-container *ngIf="data.status === 20">异常</ng-container>
          </td>
        </tr>
      </tbody>
    </nz-table>
  </ng-container>
  <div *nzModalFooter>
    <div class="form-button-container">
      <button nz-button nzType="default" (click)="onBack()">关闭</button>
    </div>
  </div>
</nz-modal>
<building-selector (buildingSelectedEvent)="handleBuildingSelectedEvent($event)"></building-selector>
